﻿using J.Customer.Application.Command.CustomerListCommand;
using J.Customer.Application.Command.MemberCardCommand;
using J.CustomerGet.Application.Command.CustomerListCommand;
using J.CustomerModel;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using StatusDto;

namespace J.CustomerGet.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CustomerListController : ControllerBase
    {
        private readonly IMediator mediator;
        public CustomerListController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 客户列表显示
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<PageDto<CustomerList>> GetCustomerShow(CustomerShowCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 客户详情
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<CustomerList> GetCustomerDetail(CustomerDetailsCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 客户添加
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> CustomerAdd(CustomerAddCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 手机号查询
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<List<CustomerList>> GetCustomer(CustomerCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 会员卡添加
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> MemberCardAdd(MemberCardAddCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 会员卡详情
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<MemberCard> GetCustomerDetail(MemberCardDetailCommand command)
        {
            return await mediator.Send(command);
        }
    }
}
